<script type="text/javascript">
var fieldMsg = {
	category: "请输入大分类",
	name: "请输入中文学名",
	en_name: "请输入英文学名",
	photo: "请上传照片",
	method:"请入一般驱除方法"
};

jQuery(function() {
	jQuery('#p').uploadify({
		'uploader'  : '<?php echo JURI::root()?>includes/uploadify/uploadify.swf',
		'script'    : '<?php echo JURI::root()?>includes/uploadify/uploadify.php',
		'cancelImg' : '<?php echo JURI::root()?>includes/uploadify/cancel.png',
		'folder'    : '<?php echo JURI::root()?>includes/uploadify/uploads',
		'auto'      : true,
		'fileExt'   : '*.jpg;*.gif;*.png',
		'fileDesc'    : 'Image Files',
		'onComplete'  : function(event, ID, fileObj, response, data) {
			jQuery('#photo').val(response).next().remove();
			
			var str = "<span id='del_photo_wrap'><a href='" + response + "' target='_blank'>\u70b9\u51fb\u67e5\u770b</a>";
			str += "<a href='<?php echo JURI::root()?>includes/uploadify/uploadify.php?f=" + response + "' id='del_photo' title='\u5220\u9664'><img src='<?php echo JURI::root()?>images/delete.png' /></a></span>";
			jQuery('#pUploader').hide().parent('td').append(str);			
		}
	});
	
	//删除照片
	jQuery('#del_photo').live('click', function(){
		jQuery.get(this.href, function(){
			jQuery('#photo').val('')
			jQuery('#pUploader').show();
			jQuery('#del_photo_wrap').remove();
		});
		return false;
	});
});

</script>
<style>
.uploadifyQueueItem {
    background-color: #F5F5F5;
    border: 2px solid #E5E5E5;
    font: 11px Verdana,Geneva,sans-serif;
    margin-top: 5px;
    padding: 10px;
    width: 350px;
}
</style>
<form id="adminForm" name="adminForm" method="POST">
<fieldset>
	<div style="float: right;">
				<button onclick="saveForm(this.form);" type="submit" class="submit">
					保存</button>
				<button onclick="window.parent.document.getElementById('sbox-window').close();" type="button">
					取消</button>
	</div>
	<div class="configuration">
				新增病虫害			
	</div>
</fieldset>
<fieldset class="adminform">
<legend>新增病虫害</legend>
<table class="admintable">
	<tbody>
		<tr>
			<td width="170" class="key">
				<label for="category">
					大分类:
				</label>
			</td>
			<td>
				<input type="text" value="" size="30" id="category" name="category" class="inputbox required" maxlength="20"/>
			</td>
		</tr>
		<tr>
			<td width="170" class="key">
				<label for="name">
					中文学名:
				</label>
			</td>
			<td>
				<input type="text" value="" size="30" id="name" name="name" class="inputbox required" maxlength="20" />
			</td>
		</tr>
		
		<tr>
			<td width="170" class="key">
				<label for="en_name">
					英文学名:
				</label>
			</td>
			<td>
				<input type="text" value="" size="30" id="en_name" name="en_name" class="inputbox required" maxlength="20"/>
			</td>
		</tr>
		<tr>
			<td width="170" class="key">
				<label for="photo">
					照片:
				</label>
			</td>
			<td width="300"><input id="p" name="p" type="file" /><input id="photo" class="required" name="photo" type="hidden" /></td>
		</tr>
		
		<tr>
			<td width="170" class="key">
				<label for="method">
					一般驱除方法:
				</label>
			</td>
			<td>
				<input type="text" value="" size="30" id="method" name="method" class="inputbox required" maxlength="40"/>
			</td>
		</tr>
		
		<tr>
			<td valign="top" class="key">
				<label for="comment">
					备注:
				</label>
			</td>
			<td>
				<textarea id="comment" name="comment" rows="3" cols="30" class="inputbox"></textarea>
			</td>
		</tr>
	</tbody>
</table>
</fieldset>
<input type="hidden" name="option" value="com_farm" />
<input type="hidden" name="task" value="saveDisease" />
<input type="hidden" name="controller" value="base" />
</form>